package com.xr.wage.commonTools;

import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.DBStatement;
import com.bstek.dorado.data.db.SqlDataset;
import com.bstek.dorado.common.*;
import com.xr.common.CommUtil;
import com.xr.common.Tools;

/**
 * waTimetable_datasetTTListener
 */
public class waTimetable_datasetTTListener extends AbstractDatasetListener {
  public boolean beforeLoadData(Dataset dataset)
     throws Exception {
	  
	  String state=dataset.parameters().getString("state");
	  if(state.equalsIgnoreCase("reload")){
		  DBStatement dbs = new DBStatement();
		  dbs.setSql("begin pck_wage.waTimetable("+Tools.format(dataset.parameters().getDate("SEND_MONTH"),"yyyyMM")+"); end;");
		  dbs.execute();
		  dbs.close();
	  } 
		  
		  SqlDataset ds = (SqlDataset) dataset;
		  ds.setSql("select tt.*,(select class_type from wa_class wc where wc.waclass_id=tt.waclass_id)class_type from WA_TIMETABLE tt where tt.send_month="+Tools.format(ds.parameters().getDate("SEND_MONTH"),"yyyyMM"));
		  
	 
	  
    return true;
  }

  public void afterLoadData(Dataset dataset)
     throws Exception {

  }

}
